package com.cloud.shopping;

import com.cloud.shopping.pay.config.WeChatPayConfig;
import com.github.wxpay.sdk.WXPay;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @author John.zhang
 * @version Id: ShoppingPayApplication, v 1.0 2021/1/5 9:58 ZhiYong Exp $
 */
@SpringBootApplication
@MapperScan(basePackages = "com.cloud.shopping.pay.mapper")
public class ShoppingPayApplication {
    public static void main(String[] args) {
        SpringApplication.run(ShoppingPayApplication.class);
    }


    /**
     * 微信支付SDK对象
     *
     * @param weChatPayConfig weChatPayConfig
     * @return WXPay
     * @throws Exception
     */
    @Bean
    public WXPay wxPay(WeChatPayConfig weChatPayConfig) throws Exception {
        return new WXPay(weChatPayConfig);
    }
}
